package com.hzhjhh.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Update;

import com.hzhjhh.dto.StockDTO;
import com.hzhjhh.entity.Stock;

@Mapper
public interface StockMapper {

	static final String Update2 = "update StockPile set number=? where MerchandiseNumber=?";
	
	@Update("update sm_stock set number = #{stockPile.number} where merchandise_Code = #{stockPile.merchandiseCode}")
	@ResultMap("BaseResultMap")
	int updateByEntity(@Param("stockPile") Stock stockPile);

	/**
	 * 根据数量+商品编号，批量更新库存
	 * 
	 * @param stockPileList
	 * @return
	 */
	int batchUpdateByNumberAndCode(@Param("stockPileList") List<Stock> stockPileList);
	/**
	 * 批量插入库存数据
	 */
	int batchAdd(@Param("stockList") List<Stock> stockList);
	/**
	 * 根据条件查询库存信息
	 * 
	 * @param stockDTO 为空时则查询全部
	 */
	List<Stock> selectListByDTO(@Param("stockDto") StockDTO stockDTO);
}
